public class Thread_{
    public static void main(String[] args) throws InterruptedException {
        Cat cat = new Cat();
        cat.start();
        for (int i=0;i<20;i++){
            System.out.println(Thread.currentThread().getName());
            Thread.sleep(1000);
        }
    }
}
class Cat extends Thread{
    @Override
    public void run() {
        super.run();
        while(true){
            System.out.println("xxx");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}